<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>签约网</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>
    <style>
    .reply_input {
           display: none;
           text-align: right;
           margin-top: 0.2rem;
       }

       .reply_input input {
           width: 100%;
           line-height: 0.5rem;
           height: 0.5rem;
           border-radius: 3px;
           font-size: 0.26rem;
           border: 1px #dddddd solid;
           padding: 0 0.1rem;
           -webkit-box-sizing: border-box;
           -moz-box-sizing: border-box;
           box-sizing: border-box;
       }

       .reply_input .subBtn {
           margin-top: 0.2rem;
           color: #1c83ea;
       }
</style>
</head>
<body>
<div id="secHeader">
  <header class="header">
      <a href="javascript:void(0);" onclick="api.closeWin()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
      <h2>我的评价</h2>
      <!--<a href="javascript:;" class="tel_btn">保存</a>-->
  </header>
</div>
<section class="evaluate_kinds">
    <ul>
        <!-- <li>全部(20)</li>
        <li>讲解耐心(5)</li>
        <li>回复及时(5)</li>
        <li>分析到位(5)</li>
        <li>服务热情(5)</li> -->
    </ul>
</section>
<section class="evaluate_list">
    <ul id='con'>

        <!-- <li>
            <div class="evaluate_user">
                <img src="../image/infoImg1.png" alt="">
                <div class="info">
                    <p>138****5815</p>
                    <span>服务方式：电话咨询</span>
                </div>
                <em>2019-04-25</em>
            </div>
            <div class="evaluate_info">
                <p>非常不错，律师很耐心，也非常专业，完美解决了我的问题。</p>
            </div>
            <div class="reply_section">

                <div class="reply_btn">
                    <a href="javascript:void (0);" class="">回复</a>
                </div>
            </div>
        </li>
        <li>
            <div class="evaluate_user">
                <img src="../image/infoImg1.png" alt="">
                <div class="info">
                    <p>138****5815</p>
                    <span>服务方式：电话咨询</span>
                </div>
                <em>2019-04-25</em>
            </div>
            <div class="evaluate_info">
                <p>非常不错，律师很耐心，也非常专业，完美解决了我的问题。</p>
            </div>
            <div class="reply_section">
                <div class="reply_content">
                    <p>作者回复: <span class="reply_detail">感谢您的评价</span></p>
                </div>
            </div>
        </li> -->
    </ul>
</section>

</body>

<script>
     var page=0;
    var ajid=0;
    var choose=1;
    var sort=0;

    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });


        api. addEventListener({name:'scrolltobottom'}, function(ret, err){

            toDoRequest();

        });

        toDoRequest();

        //下拉刷新
        api.setRefreshHeaderInfo({
          visible: true,
          bgColor: 'rgba(255,255,255,255)',
          textColor: '#666',
          textDown: '下拉刷新',
          textUp: '释放刷新'
        }, function(ret, err) {
          toDoRefresh();
        });
    };




    function toDoRequest(){
      page++;
        var p={token:token,page:page};
        api.ajax({
                url: webSiteUrl+'/app/user/spl',
                method: 'post',
                data: {
                    values: p
                }
            }, function(ret, err) {
                api.hideProgress();

                if(ret.code==200){

                    html = "";
                    var tj=ret.data;
                    if(tj != null){

                      for (var i = 0; i < tj.length; i++) {

                          html += '<li><div class="evaluate_user"><img src="' + webSiteUrl + tj[i].icon + '" alt=""><div class="info"><p>' + tj[i].phone + '</p><span>服务方式：' + tj[i].ordertype + '</span></div><em>' + tj[i].time + '</em></div><div class="evaluate_info" style="margin-top: 0.1rem;"><p>' + tj[i].content + '</p></div><div class="reply_section" id="' + tj[i].id + '">';
                          if (tj[i].reply == null) {
                              html += '<div class="reply_input">\n' +
                                  '                    <input type="text" placeholder="请输入回复内容">\n' +
                                  '                    <button class="subBtn" onclick="replypl(' + tj[i].id + ',this)">提交</button>\n' +
                                  '                </div><div class="reply_btn"><a href="javascript:void (0);" class="huifuBtn" >回复</a></div>';
                          } else {
                              html += '<div class="reply_content"><p>作者回复: <span class="reply_detail">' + tj[i].reply + '</span></p></div>';
                          }
                          html += '</div></li>';

                      }
                    }
                    $('#con').append(html);


                }else{

                    if(page==1){
                        $('#con').html('<p style="text-align:center">暂无数据</p>');
                    }

                }
            });

    }
    $(document).on("click",'.huifuBtn',function () {
        $(this).hide();
        $(this).parents('.reply_btn').siblings('.reply_input').show();
    });

    function replypl(id,obj) {
        var reply = $(obj).siblings('input').val();

        console.log(reply)
        if (reply == '') {
            alert('请输入回复内容');
            return;
        }
        var p = {token: token, reply: reply, id: id}
        $.post(webSiteUrl + '/app/user/replypl', p, function (ret) {

            if (ret.code == 200) {
                location.reload();

            }
        });
    }


    // function replypl(id){
    //     var reply=$('#reply').val();
    //     if(reply==''){
    //         alert('请输入回复内容');return;
    //     }
    //     var p={token:token,reply:reply,id:id}
    //     api.ajax({
    //         url: webSiteUrl+'/app/user/replypl',
    //         method: 'post',
    //         data: {
    //             values:p
    //         }
    //     }, function(ret, err) {
    //         if(ret.code==200){
    //             var h='<div class="reply_content"><p>作者回复: <span class="reply_detail">'+reply+'</span></p></div>';
    //             $('#'+id).html(h);
    //
    //         }
    //     });
    // }


</script>
</html>
